Initializing the JumioClient

JumioClient implements the Builder pattern to make it easy to configure and initialize. It is usually created as a Spring Bean so it can be injected and used as needed in your application.

To configure JumioClient you need to provide:

  • A DataCenter object representing the Jumio datacenter your application will be using. These objects are defined as public static instances in the DataCenters class, and can be accessed by DataCenters.US, DataCenters.EU, or DataCenters.SGP.

  • A UsernamePassword object constructed from your OAuth2 credentials, obtained from the Jumio Portal. See API Credentials.

  • A String with the value you want to use for the User-Agent header in calls to Jumio.

  • (optional) A ClientHttpRequestFactory instance, if you want to use a Spring RestTemplate other than the default.

Example: JumioClient Bean

import com.jumio.sdk.kyx.DataCenters;
import com.jumio.sdk.kyx.JumioClient;
import com.jumio.sdk.kyx.UsernamePassword;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JumioClientProvider {

    @Bean
    public JumioClient jumioClient() {
        return JumioClient.builder()
                .dataCenter(DataCenters.EU)
                .oauthCredentials(new UsernamePassword("xyz123...", "123xyz..."))
                .userAgent("MyCompany Test/1.1")
                .defaultRestTemplate()
                .build();
    }
}

Builder Steps

Builder Method Parameters Description Return Type

builder()

 

Returns the first builder step.

BuilderStep1
dataCenter() DataCenter accessed as static object from DataCenters. DataCenters provides static references to pre-defined objects for the Jumio datacenters. BuilderStep2

oauthCredentials

UsernamePassword

Object containing your OAuth2 user name and password that you can obtain from the Jumio Portal. See API Credentials.

BuilderStep3

userAgent()

String

The value you want to use as the user-agent header in the underlying REST request.

BuilderStep4

defaultRestTemplate()

or

customRestTemplate()

No parameters

or

ClientHttpRequestFactory

Use the default Spring RestTemplate or specify an alternative RestTemplate. FinalBuilderStep

build()

 

Returns the configured JumioClient.

JumioClient